{extend name="iframe" /}
{block name="css"}
{css href="__AD_CSS__/login.css" /}
{/block}
{block name="body"}
<div class="login-wrapper layui-anim layui-anim-scale">
    <form class="layui-form">
        <h2>{$config.sitename|default=$Think.lang.Title} 管理系统</h2>
        <div class="layui-form-item layui-input-icon-group">
            <i class="layui-icon layui-icon-username"></i>
            <input class="layui-input" name="name" placeholder="请输入登录账号" autocomplete="off"
                   lay-verType="tips" lay-verify="required" required/>
        </div>
        <div class="layui-form-item layui-input-icon-group">
            <i class="layui-icon layui-icon-password"></i>
            <input class="layui-input" name="pwd" placeholder="请输入登录密码" type="password"
                   lay-verType="tips" lay-verify="required" required/>
        </div>
        {notempty name="$config.vercode"}
        <div class="layui-form-item layui-input-icon-group login-captcha-group">
            <i class="layui-icon layui-icon-auz"></i>
            <input type="text" name="vercode" lay-verify="required" placeholder="请输入验证码" class="layui-input">
            <img class="login-captcha" alt=""/>
        </div>
        {/notempty}
        <div class="layui-form-item">
            <input type="checkbox" name="remember" title="记住密码" lay-skin="primary" checked>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-fluid" lay-filter="loginSubmit" lay-submit>登录</button>
        </div>
    </form>
</div>
<div class="login-copyright">copyright © 2020 {$config.copyright|default=$Think.lang.copyright} all rights reserved.</div>
{/block}
{block name="js"}
{js href="__AD_JS__/ribbon.js" /}
<script>
layui.use(['form'], function () {
    var form = layui.form;
    form.on('submit(loginSubmit)', function (data) {
        $.ajax({
            url: 'login.html',
            type: 'post',
            dataType: 'json',
            data: $(data.form).serialize(),
            success: function(result) {
                if (result.code === 1) {
                    layer.msg(result.msg,{icon:6});
                    setTimeout(function(){
                        location.href = result.url;
                    },600);                             
                } else {
                    layer.msg(result.msg,{icon:5});
                }
            }
        });
        return false;
    });
});
    /* 图形验证码 */
    var captchaUrl = '/captcha.html';
    $('img.login-captcha').click(function () {
        this.src = captchaUrl + '?t=' + (new Date).getTime();
    }).trigger('click');
</script>
{/block}